#region Usings

using System.Collections;
using System.Web;
using Moq;
using NUnit.Framework;
using Karma.Framework.Core.IoC;
using Karma.Framework.Core.Security;
using Karma.Framework.Core.Test.Security;
using Karma.Framework.Core.Web;

#endregion

namespace Karma.Framework.Core.Test.Services
{
    [TestFixture]
    public class ApplicationServiceFixture
    {
        #region Setup/Teardown

        [SetUp]
        public void SetUp()
        {
            var context = new Mock<HttpContextBase>(MockBehavior.Loose);
            var session = new Mock<HttpSessionStateBase>(MockBehavior.Loose);
            var items = new Hashtable();
            context.Expect(ctx => ctx.Session).Returns(session.Object);
            context.ExpectGet(ctx => ctx.Items).Returns(items);
            context.ExpectGet(ctx => ctx.User).Returns(new User {Access = true});
            HttpContextFactory.SetHttpContext(context.Object);
            Context.Initialize(new User {Access = true});
        }

        #endregion

        [Test]
        public void GetMethodTest()
        {
            var service = IoCFactory.Resolve<TestService>();
            var something = service.Get();

            Assert.IsTrue(something == 100);
        }

        [Test]
        [Ignore]
        public void PropertyAccessTest()
        {
        }
    }
}